/*
 * @Description: 用户的登录
 * @Version: 1.0
 * @Author: YueXuanzi
 * @Date: 2024-09-08 15:06:38
 * @LastEditors: YueXuanzi
 * @LastEditTime: 2024-09-12 11:05:59
 * @心得体会: 无
 */
// pinia的使用
import { defineStore} from 'pinia'
import { reactive, ref, computed, shallowRef, markRaw } from 'vue'
// 在这里进行配置
// // 引入所有组件
// import Doctor from "@/views/doctor/Doctor.vue"
// import Leave from "@/views/doctor/Leave.vue"
// import Record from "@/views/doctor/Record.vue"
// import Register from "@/views/doctor/Register.vue"
// import Visit from "@/views/doctor/Visit.vue"
// // other 组件
// import Payregister from "@/views/other/Payregister.vue"
// import ProjectCheck from "@/views/other/ProjectCheck.vue"
// import Registerhospital from "@/views/other/Registerhospital.vue"
// import RegisterOne from "@/views/other/RegisterOne.vue"
// // patient组件
// import Patient from "@/views/patient/Patient.vue"
// import Appointment from "@/views/patient/Appointment.vue"
// import Department from "@/views/patient/Department.vue"
// import Reservation from "@/views/patient/Reservation.vue"
// import Visitrecord from "@/views/patient/Visitrecord.vue"
// import Discharge from "@/views/patient/pay/Discharge.vue"
// import Pay from "@/views/patient/pay/Pay.vue"
// import Prescription from "@/views/patient/pay/Prescription.vue"
// import Project from "@/views/patient/pay/Project.vue"
// // 管理员组件
// import User from "@/views/user/User.vue"
// import Bound from "@/views/user/bound/Bound.vue"
// import Drug from "@/views/user/bound/Drug.vue"
// import Expire from "@/views/user/bound/Expire.vue"
// import Inout from "@/views/user/bound/Inout.vue"
// import Log from "@/views/user/bound/Log.vue"
// import DepartmentInfo from "@/views/user/information/DepartmentInfo.vue"
// const config = {
//     // Doctor : "@/views/doctor/Doctor.vue",
//     // Leave : "@/views/doctor/Leave.vue",
//     Doctor,
//     Leave,
//     Record,
//     Register,
//     Visit,
//     Payregister,
//     ProjectCheck,
//     Registerhospital,
//     RegisterOne,
//     Patient,
//     Appointment,
//     Department,
//     Reservation,
//     Visitrecord,
//     Discharge,
//     Pay,
//     Prescription,
//     Project,
//     User,
//     Bound,
//     Drug ,
//     Expire,
//     Inout,
//     Log,
//     DepartmentInfo
// }




const state = reactive({
    user:{},
    router:[]
})
const getters ={
    getUser: computed(() => state.user),
    getRouter: computed(() => state.router),
}
const mutations = {
    setRouter(router){
        for(var i = 0; i < router.length; i++){
            if(router[i].children){
                mutations.setRouter(router[i].children)
            }
        }
        state.router = router
    },
    setUser(user){
        state.user = user
    },
}

export const userDateStore = defineStore('userData',()=>{
    return {state,getters, mutations}
})
